using System.Collections.Generic;
using System.Data;
using Persistencia;
using SearchServer.Exceptions;

namespace SearchServer.AppManager
{
    public class IndexadorManager
    {

        private IndexadoPersistence _indexadorPersistence;

        public IndexadorManager()
        {
            _indexadorPersistence = new IndexadoPersistence();
        }


        public static IndexadorManager GetInstancia()
        {
            return new IndexadorManager();
        }

        /// 
        /// <param name="idUsuario"></param>
        /// <param name="idIndexador"></param>
        public void ModificarIndexador(int idUsuario, int idIndexador)
        {
            try
            {
                _indexadorPersistence.ModificarIndexador(idUsuario, idIndexador);
            }
            catch (DataException)
            {
                throw new BusinessException(BusinessException.ERROR_BD);
            }
        }

        public List<FileSystemElement> ObtenerFileSystemElements()
        {
            try
            {
                return _indexadorPersistence.ObtenerFileSystemElements();
            }
            catch (DataException)
            {
                throw new BusinessException(BusinessException.ERROR_BD);
            }
        }

        public List<Indexado> ObtenerTiposIndexado()
        {
            try
            {
                return _indexadorPersistence.ObtenerTiposIndexado();
            }
            catch (DataException)
            {
                throw new BusinessException(BusinessException.ERROR_BD);
            }
        }
    }

}